home *** CD-ROM | disk | FTP | other *** search
/ SGI ONC3 NFS v3 / SGI ONC3 NFS v3.iso / dist / dist6.5 / nfs.idb / usr / include / sys / fs / autofs.h.z / autofs.h
C/C++ Source or Header  |  1998-05-06  |  4KB  |  139 lines

  1. /*
  2.  * Copyright (c) 1993 by Sun Microsystems, Inc.
  3.  */
  4.  
  5. /*
  6.  * Autofs mount info - one per mount
  7.  */
  8.  
  9. #ifndef    _SYS_FS_AUTOFS_H
  10. #define    _SYS_FS_AUTOFS_H
  11.  
  12. #ifdef    __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16. #undef    MAXNAMLEN
  17. #define    MAXNAMLEN    255
  18.  
  19. #include <netinet/in.h>
  20. #include <sys/time.h>
  21.  
  22. /* Private well-known port */
  23. #define AUTOFS_PORT 2048
  24.  
  25. struct autofs_args {
  26.     char            *path;        /* autofs mountpoint */
  27.     char            *opts;        /* default mount options */
  28.     char            *map;        /* name of map */
  29.     time_t            mount_to;    /* seconds fs remains */
  30.                         /* mounted after last ref */
  31.     time_t             rpc_to;        /* timeout for rpc calls */
  32.     int            direct;        /* 1 = direct mount */
  33. };
  34.  
  35. #ifdef    _KERNEL
  36.  
  37. struct irix5_autofs_args {
  38.     app32_ptr_t        path;        /* autofs mountpoint */
  39.     app32_ptr_t        opts;        /* default mount options */
  40.     app32_ptr_t        map;        /* name of map */
  41.     time_t            mount_to;    /* seconds fs remains */
  42.                         /* mounted after last ref */
  43.     time_t             rpc_to;        /* timeout for rpc calls */
  44.     int            direct;        /* 1 = direct mount */
  45. };
  46.  
  47. /*
  48.  * The autonode is the "inode" for autofs.  It contains
  49.  * all the information necessary to handle automatic mounting.
  50.  */
  51. typedef struct autonode {
  52.     char        an_name[MAXNAMLEN + 1];
  53.     u_short        an_mode;    /* file mode bits */
  54.     uid_t        an_uid;
  55.     gid_t        an_gid;
  56.     ino_t        an_nodeid;    /* unique id */
  57.     off_t        an_offset;    /* offset within parent dir */
  58.     u_short        an_waiters;
  59.     u_short        an_count;    /* ref count */
  60.     u_int        an_mntflags;    /* mount flags */
  61.     u_int        an_size;    /* size of directory */
  62.     bhv_desc_t    an_bhv_desc;    /* autofs behavior descriptor */
  63.     struct vnode an_vnode;        /* place hldr vnode for file */
  64.     time_t        an_ref_time;    /* time last referred */
  65.     int        an_error;    /* mount error */
  66.     struct autonode *an_parent;    /* parent dir for .. lookup */
  67.     struct autonode *an_next;    /* next sibling */
  68.     struct autonode *an_dirents;    /* autonode list under this */
  69.     struct autoinfo    *an_ainfo;    /* points to autoinfo */
  70.     krwlock_t    an_rwlock;    /* serialize access for lookup */
  71.                     /* and enter */
  72.     sema_t        an_mnt_wait;    /* sync sema for mount wait */
  73.     kcondvar_t    an_cv_mount;    /* wakeup address */
  74.     kcondvar_t    an_cv_umount;    /* wakeup address */
  75.     kmutex_t    an_lock;    /* protection */
  76. } autonode_t;
  77.  
  78.  
  79. struct autoinfo {
  80.     struct vnode        *ai_rootvp;    /* root vnode */
  81.     struct autonode        *ai_root;    /* root autonode */    
  82.     int             ai_refcnt;    /* reference count */
  83.     char            *ai_path;    /* autofs mountpoint */
  84.     int             ai_pathlen;    /* autofs mountpoint len */
  85.     char            *ai_opts;    /* default mount options */
  86.     int             ai_optslen;    /* default mount options len */
  87.     char            *ai_map;    /* name of map */
  88.     int             ai_maplen;    /* name of map len */
  89.     time_t             ai_mount_to;
  90.     time_t             ai_rpc_to;
  91.     int             ai_direct;    /* 1 = direct mount */
  92.     bhv_desc_t        ai_bhv;        /* autofs behavior descriptor */
  93. };
  94.  
  95.  
  96. /*
  97.  * Mount flags
  98.  */
  99.  
  100. #define    MF_MNTPNT        0x001        /* A mountpoint */
  101. #define    MF_INPROG        0x002        /* mount in progress */
  102. #define    MF_WAITING_MOUNT    0x004        /* thread waiting */
  103. #define    MF_WAITING_UMOUNT    0x008
  104. #define    MF_MOUNTED        0x010        /* mount taken place */
  105. #define    MF_UNMOUNTING        0x020        /* unmount in prog */
  106. #define    MF_DONTMOUNT        0x040        /* unmount failed, so don't */
  107.                         /* try another mount */
  108. #define    MF_CHECKED        0x080        /* checked by unmount thread */
  109. /*
  110.  * Convert between vfs/autoinfo & vnode/autonode
  111.  */
  112. #define antovn(ap)      (&((ap)->an_vnode))
  113. #define    bhvtoan(bdp)    ((autonode_t *) (BHV_PDATA(bdp)))
  114. #define    antobhv(ap)    (&((ap)->an_bhv_desc))
  115. #define antoai(ap)    ((ap)->an_ainfo)
  116. #define vfs_bhvtoai(bdp)    ((struct autoinfo *)BHV_PDATA(bdp))
  117.  
  118. extern kmutex_t autonode_list_lock;
  119. extern struct autonode *autonode_list;
  120. extern kmutex_t autonode_count_lock;
  121. extern int anode_cnt, freeautonode_count;
  122.  
  123. extern int    do_mount(bhv_desc_t *, char *, struct cred *);
  124. extern int    autodir_lookup(bhv_desc_t *, char *, bhv_desc_t **, struct cred *);
  125. extern int    auto_direnter(autonode_t *, autonode_t *);
  126. extern void    do_unmount(void);
  127. extern autonode_t    *makeautonode(vtype_t, vfs_t *, struct autoinfo *, struct cred *);
  128. extern void    freeautonode(autonode_t *anp);
  129. extern void    auto_dprint(int var, int level, char *str, ...);
  130.  
  131. extern vfsops_t autofs_vfsops;
  132. #endif    /* _KERNEL */
  133.  
  134. #ifdef    __cplusplus
  135. }
  136. #endif
  137.  
  138. #endif    /* _SYS_FS_AUTOFS_H */
  139.